#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<string.h>
int main()
{
	char arr[80];
	gets(arr);
	size_t len = strlen(arr);
	int offset = 0;
	scanf("%d", &offset);
	offset = offset % 26;
	for (int i = 0; i < len; i++) {
		if (arr[i] >= 'A' && arr[i] <= 'Z') {
			if ((arr[i] + offset) > 'Z') {
				arr[i] += offset - 26;
			}
			else if((arr[i]+offset)<'A') {
				arr[i] += 26 + offset;
			}
			else {
				arr[i] += offset;
			}
		}
		if (arr[i] >= 'a' && arr[i] <= 'z') {
			if ((arr[i] + offset) > 'z') {
				arr[i] += offset - 26;
			}
			else if ((arr[i] + offset) < 'a') {
				arr[i] += 26 + offset;
			}
			else {
				arr[i] += offset;
			}
		}
	}
	printf("%s\n", arr);
	return 0;
}